import { InputQuestion, QuestionBase, SelectQuestion } from '@/components/public-template';
import { regExp } from '@/utils/regExp';
import { Api as ApiSystem } from '@/config/api/system';

class IndexService {
  getQuestions() {
    const questions: QuestionBase<any>[] = [
      new InputQuestion({
        key: 'code',
        label: '文件权限编码',
        required: true,
        type: 'slot',
        state: {
          slotName: 'generateCode'
        }
      }),
      new InputQuestion({
        key: 'name',
        label: '文件权限名称',
        required: true,
        reg: regExp.len30,
        prompt: '文件权限名称不能为空，长度在50个字符之内',
        value: null
      }),
      // new SelectQuestion({
      //   key: 'toDepartment',
      //   label: '角色',
      //   required: true,
      //   prompt: '请选择',
      //   state: {
      //     mode: 'multiple',
      //     url: Api.roleList,
      //     protType: 'post',
      //     nameKey: 'name',
      //     nameValue: 'id'
      //   }
      // }),
      new SelectQuestion({
        key: 'dept',
        label: '组织机构',
        required: true,
        value: [],
        type: 'tree',
        prompt: '请选择',
        state: {
          url: ApiSystem.orgTreeData,
          protType: 'post',
          nameKey: 'name',
          nameValue: 'id',
          nameChildren: 'childOrg',
          treeCheckable: true,
          echoNodes: 'showAll'
        }
      }),
      new InputQuestion({
        key: 'remark',
        label: '备注',
        reg: regExp.len200,
        prompt: '长度在200个字符之内'
      })
      // new InputQuestion({
      //   key: 'slot',
      //   label: '文件类型权限',
      //   value: [],
      //   type: 'slot',
      //   state: {
      //     grid: 24,
      //     slotName: 'fileAuthorityType',
      //     extendParams: {
      //       value2: '1'
      //     }
      //   }
      // })
    ];
    return questions;
  }
}

export default new IndexService();
